<!doctype html>
<html>
<head>
	<meta charset="UTF-8">
	<title></title>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<link href="../css/mui.min.css" rel="stylesheet" />
	<link rel="stylesheet" type="text/css" href="../css/order.css"/>	
	<style type="text/css">
		.mui-pull-top-pocket{
			top: 40px;
		}
		.orderHead{
			position: relative;
			z-index: 100;
		}
	</style>
</head>
<body class="gray">
	<div class="mui-content">
		<div class="mui-row orderHead">
			<div class="mui-col-xs-6 mui-col-sm-6 active" data-type="1"><span>待确认</span></div>
			<div class="mui-col-xs-6 mui-col-sm-6" data-type="2"><span>待付尾款</span></div>
		</div>	    
	</div>
	<div class="cart-count mui-clearfix" id="cart-count" style="opacity: 0;">
		<div class="mui-pull-right joinOrder"  >
			结算(<b id="cartNum">0</b>)
		</div>
		<div class="count" style="text-align: left; padding-left: 10px;">
			<div class="mui-input-row mui-checkbox allCheckbox mui-left mui-pull-left">
				<label>全选</label>
				<input name="v1" value="1" type="checkbox" >
			</div>
			<span>合计：¥ <span id="cartCount">0</span></span>
		</div>
	</div>
<script src="../js/mui.js"></script>
<script src="../js/bexta.js"></script>
<script type="text/javascript">
	var views, subView;
	mui.init({
		beforeback:function(){
			mui.fire(plus.webview.getWebviewById('center'), 'updateOrderStatus');
		}
	});
	mui.plusReady(function () {
	    views = bexta.getWebview();
	    var offsetTop = '42px';
	    if( mui.os.android ){
	    		offsetTop = 87 + bexta.getStatusHeight() + 'px'; 
	    }
	    subView = mui.preload({
	    		id:'order1',
	    		url:'order1.html',
	    		styles:{
	    			top:offsetTop, 
	    			bottom:'0'
	    		},
	    		extras:{
	    			orderType:views.orderType
	    		}
	    });
	    views.append(subView);
	    mui('.orderHead').on('tap', 'div', function(){
	 		document.querySelector('.orderHead div.active').classList.remove('active');
	 		this.classList.add('active');
	 		var type = this.getAttribute('data-type');
	 		if( type==2 ){
	 			subView.setStyle({
	 				bottom:'50px'
	 			});
	 			document.querySelector('#cart-count').style.opacity = 1;
	 		}else{
	 			subView.setStyle({
	 				bottom:'0'
	 			})
	 			document.querySelector('#cart-count').style.opacity = 0;
	 		}
	 		mui.fire(subView, 'toggleTab',{
	 			orderType:type
	 		});
	 	});
	 	//全选
	 	document.querySelector('.allCheckbox').addEventListener('tap', function(){
	 		var input = this.querySelector('input');
	 		mui.later(function(){
	 			mui.fire(subView, 'toggleCheckbox', {
	 				flag:input.checked?1:0
	 			});
	 		},10)
	 	});
	 	document.querySelector('.joinOrder').addEventListener('tap', function(){
	 		mui.fire(subView, 'wind');
	 	});
	});
window.addEventListener('showCont', function(evt){
	document.querySelector('#cartNum').innerHTML = evt.detail.nums || 0;
	document.querySelector('#cartCount').innerHTML = evt.detail.counts || 0;
});
</script>
</body>
</html>